home *** CD-ROM | disk | FTP | other *** search
/ AmigActive 10 / AACD 10.iso / AACD / Games / MAME / src / drivers / commando.c < prev    next >
C/C++ Source or Header  |  2000-05-04  |  21KB  |  580 lines

  1. /***************************************************************************
  2.  
  3. Commando memory map (preliminary)
  4.  
  5. driver by Nicola Salmoria
  6.  
  7.  
  8. MAIN CPU
  9. 0000-bfff ROM
  10. d000-d3ff Video RAM
  11. d400-d7ff Color RAM
  12. d800-dbff background video RAM
  13. dc00-dfff background color RAM
  14. e000-ffff RAM
  15. fe00-ff7f Sprites
  16.  
  17. read:
  18. c000      IN0
  19. c001      IN1
  20. c002      IN2
  21. c003      DSW1
  22. c004      DSW2
  23.  
  24. write:
  25. c808-c809 background scroll y position
  26. c80a-c80b background scroll x position
  27.  
  28. SOUND CPU
  29. 0000-3fff ROM
  30. 4000-47ff RAM
  31.  
  32. write:
  33. 8000      YM2203 #1 control
  34. 8001      YM2203 #1 write
  35. 8002      YM2203 #2 control
  36. 8003      YM2203 #2 write
  37.  
  38. ***************************************************************************/
  39.  
  40. #include "driver.h"
  41. #include "vidhrdw/generic.h"
  42.  
  43.  
  44.  
  45. extern unsigned char *commando_bgvideoram,*commando_bgcolorram;
  46. extern size_t commando_bgvideoram_size;
  47. extern unsigned char *commando_scrollx,*commando_scrolly;
  48. WRITE_HANDLER( commando_bgvideoram_w );
  49. WRITE_HANDLER( commando_bgcolorram_w );
  50. WRITE_HANDLER( commando_spriteram_w );
  51. WRITE_HANDLER( commando_c804_w );
  52. int commando_vh_start(void);
  53. void commando_vh_stop(void);
  54. void commando_vh_convert_color_prom(unsigned char *palette, unsigned short *colortable,const unsigned char *color_prom);
  55. void commando_vh_screenrefresh(struct osd_bitmap *bitmap,int full_refresh);
  56.  
  57.  
  58.  
  59. static int commando_interrupt(void)
  60. {
  61.     return 0x00d7;    /* RST 10h - VBLANK */
  62. }
  63.  
  64.  
  65.  
  66. static struct MemoryReadAddress readmem[] =
  67. {
  68.     { 0x0000, 0xbfff, MRA_ROM },
  69.     { 0xc000, 0xc000, input_port_0_r },
  70.     { 0xc001, 0xc001, input_port_1_r },
  71.     { 0xc002, 0xc002, input_port_2_r },
  72.     { 0xc003, 0xc003, input_port_3_r },
  73.     { 0xc004, 0xc004, input_port_4_r },
  74.     { 0xd000, 0xffff, MRA_RAM },
  75.     { -1 }    /* end of table */
  76. };
  77.  
  78. static struct MemoryWriteAddress writemem[] =
  79. {
  80.     { 0x0000, 0xbfff, MWA_ROM },
  81.     { 0xc800, 0xc800, soundlatch_w },
  82.     { 0xc804, 0xc804, commando_c804_w },
  83.     { 0xc808, 0xc809, MWA_RAM, &commando_scrolly },
  84.     { 0xc80a, 0xc80b, MWA_RAM, &commando_scrollx },
  85.     { 0xd000, 0xd3ff, videoram_w, &videoram, &videoram_size },
  86.     { 0xd400, 0xd7ff, colorram_w, &colorram },
  87.     { 0xd800, 0xdbff, commando_bgvideoram_w, &commando_bgvideoram, &commando_bgvideoram_size },
  88.     { 0xdc00, 0xdfff, commando_bgcolorram_w, &commando_bgcolorram },
  89.     { 0xe000, 0xfdff, MWA_RAM },
  90.     { 0xfe00, 0xff7f, commando_spriteram_w, &spriteram, &spriteram_size },
  91.     { 0xff80, 0xffff, MWA_RAM },
  92.     { -1 }    /* end of table */
  93. };
  94.  
  95.  
  96.  
  97. static struct MemoryReadAddress sound_readmem[] =
  98. {
  99.     { 0x0000, 0x3fff, MRA_ROM },
  100.     { 0x4000, 0x47ff, MRA_RAM },
  101.     { 0x6000, 0x6000, soundlatch_r },
  102.     { -1 }    /* end of table */
  103. };
  104.  
  105. static struct MemoryWriteAddress sound_writemem[] =
  106. {
  107.     { 0x0000, 0x3fff, MWA_ROM },
  108.     { 0x4000, 0x47ff, MWA_RAM },
  109.     { 0x8000, 0x8000, YM2203_control_port_0_w },
  110.     { 0x8001, 0x8001, YM2203_write_port_0_w },
  111.     { 0x8002, 0x8002, YM2203_control_port_1_w },
  112.     { 0x8003, 0x8003, YM2203_write_port_1_w },
  113.     { -1 }    /* end of table */
  114. };
  115.  
  116.  
  117.  
  118. INPUT_PORTS_START( commando )
  119.     PORT_START    /* IN0 */
  120.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  121.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  122.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
  123.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
  124.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
  125.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  126.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
  127.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  128.  
  129.     PORT_START    /* IN1 */
  130.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  131.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  132.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  133.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  134.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  135.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  136.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  137.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  138.  
  139.     PORT_START    /* IN2 */
  140.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  141.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  142.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  143.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  144.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  145.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  146.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  147.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  148.  
  149.     PORT_START    /* DSW0 */
  150.     PORT_DIPNAME( 0x03, 0x03, "Starting Stage" )
  151.     PORT_DIPSETTING(    0x03, "1" )
  152.     PORT_DIPSETTING(    0x01, "3" )
  153.     PORT_DIPSETTING(    0x02, "5" )
  154.     PORT_DIPSETTING(    0x00, "7" )
  155.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  156.     PORT_DIPSETTING(    0x04, "2" )
  157.     PORT_DIPSETTING(    0x0c, "3" )
  158.     PORT_DIPSETTING(    0x08, "4" )
  159.     PORT_DIPSETTING(    0x00, "5" )
  160.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
  161.     PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
  162.     PORT_DIPSETTING(    0x20, DEF_STR( 3C_1C ) )
  163.     PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
  164.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
  165.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
  166.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  167.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) )
  168.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_2C ) )
  169.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
  170.  
  171.     PORT_START      /* DSW1 */
  172.     PORT_DIPNAME( 0x07, 0x07, DEF_STR( Bonus_Life ) )
  173.     PORT_DIPSETTING(    0x04, "40000 50000" )
  174.     PORT_DIPSETTING(    0x07, "10000 500000" )
  175.     PORT_DIPSETTING(    0x03, "10000 600000" )
  176.     PORT_DIPSETTING(    0x05, "20000 600000" )
  177.     PORT_DIPSETTING(    0x01, "20000 700000" )
  178.     PORT_DIPSETTING(    0x06, "30000 700000" )
  179.     PORT_DIPSETTING(    0x02, "30000 800000" )
  180.     PORT_DIPSETTING(    0x00, "None" )
  181.     PORT_DIPNAME( 0x08, 0x08, DEF_STR( Demo_Sounds ) )
  182.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  183.     PORT_DIPSETTING(    0x08, DEF_STR( On ) )
  184.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Difficulty ) )
  185.     PORT_DIPSETTING(    0x10, "Normal" )
  186.     PORT_DIPSETTING(    0x00, "Difficult" )
  187.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Flip_Screen ) )
  188.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  189.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  190.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Cabinet ) )
  191.     PORT_DIPSETTING(    0x00, "Upright One Player" )
  192.     PORT_DIPSETTING(    0x40, "Upright Two Players" )
  193. /*    PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) ) */
  194.     PORT_DIPSETTING(    0xc0, DEF_STR( Cocktail ) )
  195. INPUT_PORTS_END
  196.  
  197. /* service mode replaces demo sounds, different bonus */
  198. INPUT_PORTS_START( commandu )
  199.     PORT_START    /* IN0 */
  200.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_START1 )
  201.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_START2 )
  202.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_UNUSED )
  203.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_UNUSED )
  204.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_UNKNOWN )
  205.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_UNKNOWN )
  206.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_COIN1 )
  207.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_COIN2 )
  208.  
  209.     PORT_START    /* IN1 */
  210.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY )
  211.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY )
  212.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY )
  213.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY )
  214.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 )
  215.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 )
  216.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  217.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  218.  
  219.     PORT_START    /* IN2 */
  220.     PORT_BIT( 0x01, IP_ACTIVE_LOW, IPT_JOYSTICK_RIGHT | IPF_8WAY | IPF_COCKTAIL )
  221.     PORT_BIT( 0x02, IP_ACTIVE_LOW, IPT_JOYSTICK_LEFT | IPF_8WAY | IPF_COCKTAIL )
  222.     PORT_BIT( 0x04, IP_ACTIVE_LOW, IPT_JOYSTICK_DOWN | IPF_8WAY | IPF_COCKTAIL )
  223.     PORT_BIT( 0x08, IP_ACTIVE_LOW, IPT_JOYSTICK_UP | IPF_8WAY | IPF_COCKTAIL )
  224.     PORT_BIT( 0x10, IP_ACTIVE_LOW, IPT_BUTTON1 | IPF_COCKTAIL )
  225.     PORT_BIT( 0x20, IP_ACTIVE_LOW, IPT_BUTTON2 | IPF_COCKTAIL )
  226.     PORT_BIT( 0x40, IP_ACTIVE_LOW, IPT_UNUSED )
  227.     PORT_BIT( 0x80, IP_ACTIVE_LOW, IPT_UNUSED )
  228.  
  229.     PORT_START    /* DSW0 */
  230.     PORT_DIPNAME( 0x03, 0x03, "Starting Stage" )
  231.     PORT_DIPSETTING(    0x03, "1" )
  232.     PORT_DIPSETTING(    0x01, "3" )
  233.     PORT_DIPSETTING(    0x02, "5" )
  234.     PORT_DIPSETTING(    0x00, "7" )
  235.     PORT_DIPNAME( 0x0c, 0x0c, DEF_STR( Lives ) )
  236.     PORT_DIPSETTING(    0x04, "2" )
  237.     PORT_DIPSETTING(    0x0c, "3" )
  238.     PORT_DIPSETTING(    0x08, "4" )
  239.     PORT_DIPSETTING(    0x00, "5" )
  240.     PORT_DIPNAME( 0x30, 0x30, DEF_STR( Coin_A ) )
  241.     PORT_DIPSETTING(    0x00, DEF_STR( 4C_1C ) )
  242.     PORT_DIPSETTING(    0x20, DEF_STR( 3C_1C ) )
  243.     PORT_DIPSETTING(    0x10, DEF_STR( 2C_1C ) )
  244.     PORT_DIPSETTING(    0x30, DEF_STR( 1C_1C ) )
  245.     PORT_DIPNAME( 0xc0, 0xc0, DEF_STR( Coin_B ) )
  246.     PORT_DIPSETTING(    0x00, DEF_STR( 2C_1C ) )
  247.     PORT_DIPSETTING(    0xc0, DEF_STR( 1C_1C ) )
  248.     PORT_DIPSETTING(    0x40, DEF_STR( 1C_2C ) )
  249.     PORT_DIPSETTING(    0x80, DEF_STR( 1C_3C ) )
  250.  
  251.     PORT_START      /* DSW1 */
  252.     PORT_DIPNAME( 0x07, 0x07, DEF_STR( Bonus_Life ) )
  253.     PORT_DIPSETTING(    0x07, "10000 50000" )
  254.     PORT_DIPSETTING(    0x03, "10000 60000" )
  255.     PORT_DIPSETTING(    0x05, "20000 60000" )
  256.     PORT_DIPSETTING(    0x01, "20000 70000" )
  257.     PORT_DIPSETTING(    0x06, "30000 70000" )
  258.     PORT_DIPSETTING(    0x02, "30000 80000" )
  259.     PORT_DIPSETTING(    0x04, "40000 100000" )
  260.     PORT_DIPSETTING(    0x00, "None" )
  261.     PORT_SERVICE( 0x08, IP_ACTIVE_LOW )
  262.     PORT_DIPNAME( 0x10, 0x10, DEF_STR( Difficulty ) )
  263.     PORT_DIPSETTING(    0x10, "Normal" )
  264.     PORT_DIPSETTING(    0x00, "Difficult" )
  265.     PORT_DIPNAME( 0x20, 0x00, DEF_STR( Flip_Screen ) )
  266.     PORT_DIPSETTING(    0x00, DEF_STR( Off ) )
  267.     PORT_DIPSETTING(    0x20, DEF_STR( On ) )
  268.     PORT_DIPNAME( 0xc0, 0x00, DEF_STR( Cabinet ) )
  269.     PORT_DIPSETTING(    0x00, "Upright One Player" )
  270.     PORT_DIPSETTING(    0x40, "Upright Two Players" )
  271. /*    PORT_DIPSETTING(    0x80, DEF_STR( Cocktail ) ) */
  272.     PORT_DIPSETTING(    0xc0, DEF_STR( Cocktail ) )
  273. INPUT_PORTS_END
  274.  
  275.  
  276.  
  277. static struct GfxLayout charlayout =
  278. {
  279.     8,8,    /* 8*8 characters */
  280.     1024,    /* 1024 characters */
  281.     2,    /* 2 bits per pixel */
  282.     { 4, 0 },
  283.     { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3 },
  284.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16 },
  285.     16*8    /* every char takes 16 consecutive bytes */
  286. };
  287. static struct GfxLayout tilelayout =
  288. {
  289.     16,16,    /* 16*16 tiles */
  290.     1024,    /* 1024 tiles */
  291.     3,    /* 3 bits per pixel */
  292.     { 0, 1024*32*8, 2*1024*32*8 },    /* the bitplanes are separated */
  293.     { 0, 1, 2, 3, 4, 5, 6, 7,
  294.             16*8+0, 16*8+1, 16*8+2, 16*8+3, 16*8+4, 16*8+5, 16*8+6, 16*8+7 },
  295.     { 0*8, 1*8, 2*8, 3*8, 4*8, 5*8, 6*8, 7*8,
  296.             8*8, 9*8, 10*8, 11*8, 12*8, 13*8, 14*8, 15*8 },
  297.     32*8    /* every tile takes 32 consecutive bytes */
  298. };
  299. static struct GfxLayout spritelayout =
  300. {
  301.     16,16,    /* 16*16 sprites */
  302.     768,    /* 768 sprites */
  303.     4,    /* 4 bits per pixel */
  304.     { 768*64*8+4, 768*64*8+0, 4, 0 },
  305.     { 0, 1, 2, 3, 8+0, 8+1, 8+2, 8+3,
  306.             32*8+0, 32*8+1, 32*8+2, 32*8+3, 33*8+0, 33*8+1, 33*8+2, 33*8+3 },
  307.     { 0*16, 1*16, 2*16, 3*16, 4*16, 5*16, 6*16, 7*16,
  308.             8*16, 9*16, 10*16, 11*16, 12*16, 13*16, 14*16, 15*16 },
  309.     64*8    /* every sprite takes 64 consecutive bytes */
  310. };
  311.  
  312.  
  313.  
  314. static struct GfxDecodeInfo gfxdecodeinfo[] =
  315. {
  316.     { REGION_GFX1, 0, &charlayout,   192, 16 },    /* colors 192-255 */
  317.     { REGION_GFX2, 0, &tilelayout,     0, 16 },    /* colors   0-127 */
  318.     { REGION_GFX3, 0, &spritelayout, 128,  4 },    /* colors 128-191 */
  319.     { -1 } /* end of array */
  320. };
  321.  
  322.  
  323.  
  324. static struct YM2203interface ym2203_interface =
  325. {
  326.     2,            /* 2 chips */
  327.     1500000,    /* 1.5 MHz */
  328.     { YM2203_VOL(15,15), YM2203_VOL(15,15) },
  329.     { 0 },
  330.     { 0 },
  331.     { 0 },
  332.     { 0 }
  333. };
  334.  
  335.  
  336.  
  337. static struct MachineDriver machine_driver_commando =
  338. {
  339.     /* basic machine hardware */
  340.     {
  341.         {
  342.             CPU_Z80,
  343.             4000000,    /* 4 Mhz (?) */
  344.             readmem,writemem,0,0,
  345.             commando_interrupt,1
  346.         },
  347.         {
  348.             CPU_Z80 | CPU_AUDIO_CPU,
  349.             3000000,    /* 3 Mhz */
  350.             sound_readmem,sound_writemem,0,0,
  351.             interrupt,4
  352.         }
  353.     },
  354.     60, 500,    /* frames per second, vblank duration */
  355.                 /* vblank duration is crucial to get proper sprite/background alignment */
  356.     1,    /* 1 CPU slice per frame - interleaving is forced when a sound command is written */
  357.     0,
  358.  
  359.     /* video hardware */
  360.     32*8, 32*8, { 0*8, 32*8-1, 2*8, 30*8-1 },
  361.     gfxdecodeinfo,
  362.     256,16*4+4*16+16*8,
  363.     commando_vh_convert_color_prom,
  364.  
  365.     VIDEO_TYPE_RASTER | VIDEO_UPDATE_AFTER_VBLANK,
  366.     0,
  367.     commando_vh_start,
  368.     commando_vh_stop,
  369.     commando_vh_screenrefresh,
  370.  
  371.     /* sound hardware */
  372.     0,0,0,0,
  373.     {
  374.         {
  375.             SOUND_YM2203,
  376.             &ym2203_interface
  377.         }
  378.     }
  379. };
  380.  
  381.  
  382.  
  383. /***************************************************************************
  384.  
  385.   Game driver(s)
  386.  
  387. ***************************************************************************/
  388.  
  389. ROM_START( commando )
  390.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  391.     ROM_LOAD( "m09_cm04.bin", 0x0000, 0x8000, 0x8438b694 )
  392.     ROM_LOAD( "m08_cm03.bin", 0x8000, 0x4000, 0x35486542 )
  393.  
  394.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  395.     ROM_LOAD( "f09_cm02.bin", 0x0000, 0x4000, 0xf9cc4a74 )
  396.  
  397.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  398.     ROM_LOAD( "d05_vt01.bin", 0x00000, 0x4000, 0x505726e0 )    /* characters */
  399.  
  400.     ROM_REGION( 0x18000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  401.     ROM_LOAD( "a05_vt11.bin", 0x00000, 0x4000, 0x7b2e1b48 )    /* tiles */
  402.     ROM_LOAD( "a06_vt12.bin", 0x04000, 0x4000, 0x81b417d3 )
  403.     ROM_LOAD( "a07_vt13.bin", 0x08000, 0x4000, 0x5612dbd2 )
  404.     ROM_LOAD( "a08_vt14.bin", 0x0c000, 0x4000, 0x2b2dee36 )
  405.     ROM_LOAD( "a09_vt15.bin", 0x10000, 0x4000, 0xde70babf )
  406.     ROM_LOAD( "a10_vt16.bin", 0x14000, 0x4000, 0x14178237 )
  407.  
  408.     ROM_REGION( 0x18000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  409.     ROM_LOAD( "e07_vt05.bin", 0x00000, 0x4000, 0x79f16e3d )    /* sprites */
  410.     ROM_LOAD( "e08_vt06.bin", 0x04000, 0x4000, 0x26fee521 )
  411.     ROM_LOAD( "e09_vt07.bin", 0x08000, 0x4000, 0xca88bdfd )
  412.     ROM_LOAD( "h07_vt08.bin", 0x0c000, 0x4000, 0x2019c883 )
  413.     ROM_LOAD( "h08_vt09.bin", 0x10000, 0x4000, 0x98703982 )
  414.     ROM_LOAD( "h09_vt10.bin", 0x14000, 0x4000, 0xf069d2f8 )
  415.  
  416.     ROM_REGION( 0x0600, REGION_PROMS )
  417.     ROM_LOAD( "01d_vtb1.bin", 0x0000, 0x0100, 0x3aba15a1 )    /* red */
  418.     ROM_LOAD( "02d_vtb2.bin", 0x0100, 0x0100, 0x88865754 )    /* green */
  419.     ROM_LOAD( "03d_vtb3.bin", 0x0200, 0x0100, 0x4c14c3f6 )    /* blue */
  420.     ROM_LOAD( "01h_vtb4.bin", 0x0300, 0x0100, 0xb388c246 )    /* palette selector (not used) */
  421.     ROM_LOAD( "06l_vtb5.bin", 0x0400, 0x0100, 0x712ac508 )    /* interrupt timing (not used) */
  422.     ROM_LOAD( "06e_vtb6.bin", 0x0500, 0x0100, 0x0eaf5158 )    /* video timing (not used) */
  423. ROM_END
  424.  
  425. ROM_START( commandu )
  426.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  427.     ROM_LOAD( "u4-f",         0x0000, 0x8000, 0xa6118935 )
  428.     ROM_LOAD( "u3-f",         0x8000, 0x4000, 0x24f49684 )
  429.  
  430.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  431.     ROM_LOAD( "f09_cm02.bin", 0x0000, 0x4000, 0xf9cc4a74 )
  432.  
  433.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  434.     ROM_LOAD( "d05_vt01.bin", 0x00000, 0x4000, 0x505726e0 )    /* characters */
  435.  
  436.     ROM_REGION( 0x18000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  437.     ROM_LOAD( "a05_vt11.bin", 0x00000, 0x4000, 0x7b2e1b48 )    /* tiles */
  438.     ROM_LOAD( "a06_vt12.bin", 0x04000, 0x4000, 0x81b417d3 )
  439.     ROM_LOAD( "a07_vt13.bin", 0x08000, 0x4000, 0x5612dbd2 )
  440.     ROM_LOAD( "a08_vt14.bin", 0x0c000, 0x4000, 0x2b2dee36 )
  441.     ROM_LOAD( "a09_vt15.bin", 0x10000, 0x4000, 0xde70babf )
  442.     ROM_LOAD( "a10_vt16.bin", 0x14000, 0x4000, 0x14178237 )
  443.  
  444.     ROM_REGION( 0x18000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  445.     ROM_LOAD( "e07_vt05.bin", 0x00000, 0x4000, 0x79f16e3d )    /* sprites */
  446.     ROM_LOAD( "e08_vt06.bin", 0x04000, 0x4000, 0x26fee521 )
  447.     ROM_LOAD( "e09_vt07.bin", 0x08000, 0x4000, 0xca88bdfd )
  448.     ROM_LOAD( "h07_vt08.bin", 0x0c000, 0x4000, 0x2019c883 )
  449.     ROM_LOAD( "h08_vt09.bin", 0x10000, 0x4000, 0x98703982 )
  450.     ROM_LOAD( "h09_vt10.bin", 0x14000, 0x4000, 0xf069d2f8 )
  451.  
  452.     ROM_REGION( 0x0600, REGION_PROMS )
  453.     ROM_LOAD( "01d_vtb1.bin", 0x0000, 0x0100, 0x3aba15a1 )    /* red */
  454.     ROM_LOAD( "02d_vtb2.bin", 0x0100, 0x0100, 0x88865754 )    /* green */
  455.     ROM_LOAD( "03d_vtb3.bin", 0x0200, 0x0100, 0x4c14c3f6 )    /* blue */
  456.     ROM_LOAD( "01h_vtb4.bin", 0x0300, 0x0100, 0xb388c246 )    /* palette selector (not used) */
  457.     ROM_LOAD( "06l_vtb5.bin", 0x0400, 0x0100, 0x712ac508 )    /* interrupt timing (not used) */
  458.     ROM_LOAD( "06e_vtb6.bin", 0x0500, 0x0100, 0x0eaf5158 )    /* video timing (not used) */
  459. ROM_END
  460.  
  461. ROM_START( commandj )
  462.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  463.     ROM_LOAD( "09m_so04.bin", 0x0000, 0x8000, 0xd3f2bfb3 )
  464.     ROM_LOAD( "08m_so03.bin", 0x8000, 0x4000, 0xed01f472 )
  465.  
  466.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  467.     ROM_LOAD( "09f_so02.bin", 0x0000, 0x4000, 0xca20aca5 )
  468.  
  469.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  470.     ROM_LOAD( "d05_vt01.bin", 0x00000, 0x4000, 0x505726e0 )    /* characters */
  471.  
  472.     ROM_REGION( 0x18000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  473.     ROM_LOAD( "a05_vt11.bin", 0x00000, 0x4000, 0x7b2e1b48 )    /* tiles */
  474.     ROM_LOAD( "a06_vt12.bin", 0x04000, 0x4000, 0x81b417d3 )
  475.     ROM_LOAD( "a07_vt13.bin", 0x08000, 0x4000, 0x5612dbd2 )
  476.     ROM_LOAD( "a08_vt14.bin", 0x0c000, 0x4000, 0x2b2dee36 )
  477.     ROM_LOAD( "a09_vt15.bin", 0x10000, 0x4000, 0xde70babf )
  478.     ROM_LOAD( "a10_vt16.bin", 0x14000, 0x4000, 0x14178237 )
  479.  
  480.     ROM_REGION( 0x18000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  481.     ROM_LOAD( "e07_vt05.bin", 0x00000, 0x4000, 0x79f16e3d )    /* sprites */
  482.     ROM_LOAD( "e08_vt06.bin", 0x04000, 0x4000, 0x26fee521 )
  483.     ROM_LOAD( "e09_vt07.bin", 0x08000, 0x4000, 0xca88bdfd )
  484.     ROM_LOAD( "h07_vt08.bin", 0x0c000, 0x4000, 0x2019c883 )
  485.     ROM_LOAD( "h08_vt09.bin", 0x10000, 0x4000, 0x98703982 )
  486.     ROM_LOAD( "h09_vt10.bin", 0x14000, 0x4000, 0xf069d2f8 )
  487.  
  488.     ROM_REGION( 0x0600, REGION_PROMS )
  489.     ROM_LOAD( "01d_vtb1.bin", 0x0000, 0x0100, 0x3aba15a1 )    /* red */
  490.     ROM_LOAD( "02d_vtb2.bin", 0x0100, 0x0100, 0x88865754 )    /* green */
  491.     ROM_LOAD( "03d_vtb3.bin", 0x0200, 0x0100, 0x4c14c3f6 )    /* blue */
  492.     ROM_LOAD( "01h_vtb4.bin", 0x0300, 0x0100, 0xb388c246 )    /* palette selector (not used) */
  493.     ROM_LOAD( "06l_vtb5.bin", 0x0400, 0x0100, 0x712ac508 )    /* interrupt timing (not used) */
  494.     ROM_LOAD( "06e_vtb6.bin", 0x0500, 0x0100, 0x0eaf5158 )    /* video timing (not used) */
  495. ROM_END
  496.  
  497. ROM_START( spaceinv )
  498.     ROM_REGION( 2*0x10000, REGION_CPU1 )    /* 64k for code + 64k for decrypted opcodes */
  499.     ROM_LOAD( "u4",           0x0000, 0x8000, 0x834ba0de )
  500.     ROM_LOAD( "u3",           0x8000, 0x4000, 0x07e4ee3a )
  501.  
  502.     ROM_REGION( 0x10000, REGION_CPU2 )    /* 64k for the audio CPU */
  503.     ROM_LOAD( "u2",           0x0000, 0x4000, 0xcbf8c40e )
  504.  
  505.     ROM_REGION( 0x04000, REGION_GFX1 | REGIONFLAG_DISPOSE )
  506.     ROM_LOAD( "u1",           0x00000, 0x4000, 0xf477e13a )    /* characters */
  507.  
  508.     ROM_REGION( 0x18000, REGION_GFX2 | REGIONFLAG_DISPOSE )
  509.     ROM_LOAD( "a05_vt11.bin", 0x00000, 0x4000, 0x7b2e1b48 )    /* tiles */
  510.     ROM_LOAD( "a06_vt12.bin", 0x04000, 0x4000, 0x81b417d3 )
  511.     ROM_LOAD( "a07_vt13.bin", 0x08000, 0x4000, 0x5612dbd2 )
  512.     ROM_LOAD( "a08_vt14.bin", 0x0c000, 0x4000, 0x2b2dee36 )
  513.     ROM_LOAD( "a09_vt15.bin", 0x10000, 0x4000, 0xde70babf )
  514.     ROM_LOAD( "a10_vt16.bin", 0x14000, 0x4000, 0x14178237 )
  515.  
  516.     ROM_REGION( 0x18000, REGION_GFX3 | REGIONFLAG_DISPOSE )
  517.     ROM_LOAD( "u5",           0x00000, 0x4000, 0x2a97c933 )    /* sprites */
  518.     ROM_LOAD( "e08_vt06.bin", 0x04000, 0x4000, 0x26fee521 )
  519.     ROM_LOAD( "e09_vt07.bin", 0x08000, 0x4000, 0xca88bdfd )
  520.     ROM_LOAD( "u8",           0x0c000, 0x4000, 0xd6b4aa2e )
  521.     ROM_LOAD( "h08_vt09.bin", 0x10000, 0x4000, 0x98703982 )
  522.     ROM_LOAD( "h09_vt10.bin", 0x14000, 0x4000, 0xf069d2f8 )
  523.  
  524.     ROM_REGION( 0x0600, REGION_PROMS )
  525.     ROM_LOAD( "01d_vtb1.bin", 0x0000, 0x0100, 0x3aba15a1 )    /* red */
  526.     ROM_LOAD( "02d_vtb2.bin", 0x0100, 0x0100, 0x88865754 )    /* green */
  527.     ROM_LOAD( "03d_vtb3.bin", 0x0200, 0x0100, 0x4c14c3f6 )    /* blue */
  528.     ROM_LOAD( "01h_vtb4.bin", 0x0300, 0x0100, 0xb388c246 )    /* palette selector (not used) */
  529.     ROM_LOAD( "06l_vtb5.bin", 0x0400, 0x0100, 0x712ac508 )    /* interrupt timing (not used) */
  530.     ROM_LOAD( "06e_vtb6.bin", 0x0500, 0x0100, 0x0eaf5158 )    /* video timing (not used) */
  531. ROM_END
  532.  
  533.  
  534.  
  535. static void init_commando(void)
  536. {
  537.     int A;
  538.     unsigned char *rom = memory_region(REGION_CPU1);
  539.     int diff = memory_region_length(REGION_CPU1) / 2;
  540.  
  541.  
  542.     memory_set_opcode_base(0,rom+diff);
  543.  
  544.     /* the first opcode is not encrypted */
  545.     rom[0+diff] = rom[0];
  546.     for (A = 1;A < 0xc000;A++)
  547.     {
  548.         int src;
  549.  
  550.         src = rom[A];
  551.         rom[A+diff] = src ^ (src & 0xee) ^ ((src & 0xe0) >> 4) ^ ((src & 0x0e) << 4);
  552.     }
  553. }
  554.  
  555. static void init_spaceinv(void)
  556. {
  557.     int A;
  558.     unsigned char *rom = memory_region(REGION_CPU1);
  559.     int diff = memory_region_length(REGION_CPU1) / 2;
  560.  
  561.  
  562.     memory_set_opcode_base(0,rom+diff);
  563.  
  564.     /* the first opcode *is* encrypted */
  565.     for (A = 0;A < 0xc000;A++)
  566.     {
  567.         int src;
  568.  
  569.         src = rom[A];
  570.         rom[A+diff] = src ^ (src & 0xee) ^ ((src & 0xe0) >> 4) ^ ((src & 0x0e) << 4);
  571.     }
  572. }
  573.  
  574.  
  575.  
  576. GAME( 1985, commando, 0,        commando, commando, commando, ROT90, "Capcom", "Commando (World)" )
  577. GAME( 1985, commandu, commando, commando, commandu, commando, ROT90, "Capcom (Data East USA license)", "Commando (US)" )
  578. GAME( 1985, commandj, commando, commando, commando, commando, ROT90, "Capcom", "Senjo no Ookami" )
  579. GAME( 1985, spaceinv, commando, commando, commando, spaceinv, ROT90, "bootleg", "Space Invasion" )
  580.